package main

import (
	"errors"
	"fmt"
)

func MyDiv(a,b int) (result int,err error) {
	err = nil
	if b==0 {
		err = errors.New("分母不能为0")
	}else {
        result =a / b
	}
	return
}
func main()  {
	result,err := MyDiv(1,2)
	if err !=nil{
		fmt.Println("err1=",err)
	}else {
		fmt.Println("result=",result)
	}

	result1,err1 := MyDiv(1,0)
	if err1 !=nil{
		fmt.Println("err1=",err1)
	}else {
		fmt.Println("result1=",result1)
	}
}